home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 8206 / 8206.xpi / content / webmail / yahooclassic.js < prev    next >
Text File  |  2010-02-02  |  3KB  |  102 lines

  1. //WISELOG("[yahooclassic.js] >>>>>");
  2. window.addEventListener("load",function(event){yahoosig.pageload(event)},true);
  3. window.addEventListener("unload",function(event){yahoosig.uninitView(event)},true);
  4.  
  5. var yahoosig =
  6. {
  7.     current: null,
  8.     pageload: function (event)
  9.     {
  10.         try
  11.         {
  12.             wisestampsig.refreshCallback = yahoosig.refreshSignature;
  13.             setTimeout(function ()
  14.             {
  15.                 yahoosig.setupCompose();
  16.             },
  17.             0);
  18.         } catch(e)
  19.         {
  20.             //      WISELOG(e);
  21.         }
  22.     },
  23.     uninitView: function ()
  24.     {
  25.         if (this.current && this["uninit" + this.current])
  26.         {
  27.             this["uninit" + this.current]();
  28.         }
  29.     },
  30.     setupCompose: function ()
  31.     {
  32.         yahoosig.addWisestampIcon();
  33.         var iframes = evaluateXPath(document, "//iframe[@id='compose_editorArea']");
  34.         if (iframes && iframes.length > 0)
  35.         {
  36.             for (var i = 0; i < iframes.length; i++)
  37.             yahoosig.insertSignature(iframes[i]);
  38.         }
  39.     },
  40.     addWisestampIcon: function ()
  41.     {
  42.         if (wisestampsig.showButton)
  43.         {
  44.             var iconPos = 510;
  45.             var cont = document.getElementById("compose_palette"); //.parentNode;
  46.             //style="" title="Underline" href="#Underline"/>
  47.             
  48.             //var editor = document.getElementById("compose_editorArea");
  49.             //var newWidth = 650;
  50.             //cont.setAttribute("style",cont.getAttribute("style")+" width: "+newWidth+"px;");
  51.             //editor.setAttribute("style",editor.getAttribute("style")+" width: "+newWidth+"px;");
  52.             //iconPos = 540;
  53.             
  54.             var a = document.createElement("a");
  55.             a.setAttribute("class", "DhtmlButtonText");
  56.             a.setAttribute("style", "position: absolute; top: 4px; display: block; width: 26px; height: 20px; background-image: url(" + wisestampsig.icon + "); background-position: 5px 3px; background-repeat: no-repeat; left: "+iconPos+"px;");
  57.             a.setAttribute("title", "#href=WiseStamp")
  58.             cont.appendChild(a);
  59.             wisestampsig.initOptionsIcon(a);
  60.             //var img = document.createElement("img");
  61.             //img.setAttribute("src",wisestampsig.icon);
  62.             //img.setAttribute("width","16");
  63.             //img.setAttribute("height","16");
  64.             //img.setAttribute("class","wisestampIcon");
  65.             //img.setAttribute("style","vertical-align: middle; margin-left: 10px");
  66.             //var button = img;
  67.             //cont.appendChild(button);
  68.             //wisestampsig.initOptionsIcon(button);
  69.         }
  70.     },
  71.     uninitCompose: function ()
  72.     {
  73.  
  74.     },
  75.     iframeTries: 1,
  76.     refreshSignature: function ()
  77.     {
  78.         wisestampsig.insertSignature(yahoosig.iframe, false);
  79.     },
  80.     insertSignature: function (iframe)
  81.     {
  82.         this.iframe = iframe;
  83.         this.iframe.addEventListener('load', yahoosig.iframeLoad, false);
  84.         this.iframeLoad(false);
  85.     },
  86.     iframeLoad: function (event)
  87.     {
  88.         setTimeout(function ()
  89.         {
  90.             wisestampsig.insertSignature(yahoosig.iframe, true);
  91.             if (event)
  92.             {
  93.                 try
  94.                 {
  95.                     yahoosig.iframe.removeEventListener('load', yahoosig.iframeLoad, false);
  96.                 } catch(e)
  97.                 {}
  98.             }
  99.         },
  100.         !event ? 500 : 100);
  101.     }
  102. };